import { Role } from '$/client'
import { useLoginStore } from '@/stores/loginStore'
import Cookies from 'js-cookie'

export const IsLogin = () => !!Cookies.get('token')

export const IsAdmin = () => useLoginStore().role === Role.ADMIN

export const IsStaff = () => useLoginStore().role === Role.STAFF

export const IsAdminOrStaff = () => IsStaff() || IsAdmin()

export const IsUser = () => useLoginStore().role === Role.USER

export const IsCopilot = () => useLoginStore().role === Role.COPILOT
